<!DOCTYPE html>
<html lang="en">
	<head>
		<include file="Index/head" />
	</head>

	<body>
		<include file="Index/header" />

		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>

			<div class="main-container-inner">
				<a class="menu-toggler" id="menu-toggler" href="#">
					<span class="menu-text"></span>
				</a>

				<include file="Index/menu" />
				
				<div class="main-content">
					<include file="Index/nav" />

					<div class="page-content">
						
							<!-- /**
							 * 右侧页面begin
							 */ -->
						<div class="row">
							<div class="col-xs-12">
								<!-- PAGE CONTENT BEGINS -->

								<form class="form-horizontal" role="form" action="{:U('Admin/Acshiyaoju/add_prize')}" method="POST" enctype="multipart/form-data">
									<div class="space-4"></div>
									<div class="space-4"></div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">奖品名:</label>
										<div class="col-sm-9">
											<input type="text" name="name" id="form-field-1" class="col-xs-10 col-sm-5" required="required">
										</div>
									</div>
									<div class="space-4"></div>
									<div class="space-4"></div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1"></label>
										<div class="col-sm-9">
											<img id="show_img" style="width:200px;">
											<input type="text" name="img" id="prize_img"  hidden="hidden">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 上传奖品图: </label>
										<div class="col-sm-9">
											<input type="file" id="upload_prize_img" class="col-xs-10 col-sm-5">
										</div>
									</div>
                                                                        <div class="space-4"></div>
									<div class="space-4"></div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">学校:</label>
										<div class="col-sm-9">
											<select name="school_id" required="required">
												<volist name='schools' id='vo'>
												<option value="{$vo.id}">{$vo.name}</option>
                                                                                                </volist>
												
											</select>
										</div>
									</div>
									<div class="space-4"></div>
									<div class="space-4"></div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">年级:</label>
										<div class="col-sm-9">
											<select name="grade_id" required="required">
												<option>选择年级</option>
												<option value="1">1年级</option>
												<option value="2">2年级</option>
												<option value="3">3年级</option>
												<option value="4">4年级</option>
												<option value="5">5年级</option>
												<option value="6">6年级</option>
												<option value="7">7年级</option>
												<option value="8">8年级</option>
												<option value="9">9年级</option>
												<option value="99" style="color:red;">99年级(社区)</option>
											</select>
										</div>
									</div>
									<div class="space-4"></div>
									<div class="space-4"></div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">概率:</label>
										<div class="col-sm-9">
											<input disabled="disabled" type="text" name="rate" id="form-field-1" class="col-xs-10 col-sm-5" required="required">
										</div>
									</div>
									<div class="space-4"></div>
									<div class="space-4"></div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">奖品备注:</label>
										<div class="col-sm-9">
											<input type="text" name="ramark" id="form-field-1" class="col-xs-10 col-sm-5">
										</div>
									</div>
									<div class="space-4"></div>
									<div class="space-4"></div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">奖品数量:</label>
										<div class="col-sm-9">
											<input type="text" name="quantity" id="form-field-1" class="col-xs-10 col-sm-5" required="required">
										</div>
									</div>

									<div class="space-4"></div>
									<div class="clearfix form-actions">
										<div class="col-md-offset-3 col-md-9">
											<button class="btn btn-info" type="submit">
												<i class="icon-ok bigger-110"></i>
												添加
											</button>									
										&nbsp; &nbsp; &nbsp;
										<a href="javascript:history.go(-1);">
											<button class="btn" type="button">
												<i class="icon-undo bigger-110"></i>
												返回
											</button>
										</a>
											
										</div>
									</div>

									<div class="hr hr-24"></div>

									</div><!-- /row -->

								</form>

						</div>
							<!-- /**
							 * 右侧页面end
							 */ -->
					</div><!-- /.page-content -->
				</div>

			</div><!-- /.main-container-inner -->

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->
<script type="text/javascript">
$("#upload_prize_img").on('change',function(){
	var fd = new FormData();
	// fd.append("head_banner",document.getElementById("head_banner").files[0]);
	fd.append('fimg',document.getElementById("upload_prize_img").files[0]);
	var url="{:U('Admin/Acshiyaoju/upload_prize_img')}";
	$.ajax({
		type:'POST',
		url:url,
		 // 告诉jQuery不要去处理发送的数据
		processData: false,
		 // 告诉jQuery不要去设置Content-Type请求头
		contentType: false,
		data:fd,
		dataType:'json',
		success:function(data){
			if(data==0){

				return;
				
			}else{

				$("#show_img").attr('src',data);
				$("#prize_img").val(data);
			}
		}
	});
});
</script>
		<include file="Index/footer" />
	</body>
</html>
